﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using MaximServices.Model;
using MaximServices.Services;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace maxim_portal.Controllers
{
    [EnableCors("AllowCors")]
    [Route("api/[controller]")]
    [ApiController]
    public class TargetController : ControllerBase
    {
        private MottoTargetServices _mottoTargetServices;
        public TargetController(MottoTargetServices mottoTargetServices)
        {
            _mottoTargetServices = mottoTargetServices;
        }
        // GET: api/Target
        [HttpGet]
        public ResultModel<List<string>> Get()
        {
            try
            {
                return _mottoTargetServices.GetTargetList();
            }
            catch (Exception e)
            {
                return BuildResult.Error(e.Message, default(List<string>));
            }
        }
    }
}
